package com.zw.stock_sell_storage.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zw.stock_sell_storage.dto.MyPageDto;
import com.zw.stock_sell_storage.dto.PurchasingInformationDto;
import com.zw.stock_sell_storage.dto.ex.PurchasingInformationDtoEx;
import com.zw.stock_sell_storage.dto.ex.QueryTimeScopeDtoEx;
import com.zw.stock_sell_storage.service.IPurchasingInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/purchasingInformation")
public class PurchasingInformationController {
    @Autowired
    IPurchasingInformationService iPurchasingInformationService;

    @RequestMapping("/queryPurchasingInformationList")
    public Page<PurchasingInformationDto> queryPurchasingInformationList(@RequestBody MyPageDto<QueryTimeScopeDtoEx<PurchasingInformationDto>> myPageDto){
        return iPurchasingInformationService.queryPurchasingInformationList(myPageDto);
    }

    @RequestMapping("/queryPurchasingInformationById")
    public PurchasingInformationDtoEx queryPurchasingInformationById(int purchasingId){
        return iPurchasingInformationService.queryPurchasingInformationById(purchasingId);
    }

    @RequestMapping("/addPurchasingInformation")
    public boolean addPurchasingInformation(@RequestBody PurchasingInformationDto purchasingInformationDto){
        return iPurchasingInformationService.addPurchasingInformation(purchasingInformationDto);
    }
}
